import types from './../types/index' ;
export default {
    searchData:function ({commit} , message) {
        return new Promise((resolve, reject) =>{
            commit(types.SEARCH,message)
            resolve();
        })
    },
    getBanner:function ({commit} , message) { 
        return new Promise((resolve, reject) =>{
            ajax.get({
                url:'/banner',
            }).then((res) => {
                commit(types.GETBANNER,res.data.banners)
                resolve();
            })
            .catch((error) => {
                console.log(error)
            })
            
        })
    },
    getOrder:function ({commit} , params) { 
        return new Promise((resolve, reject) =>{
            ajax.get({
                url:'/top/playlist/highquality?limit=30',
            }).then((res) => {
                commit(types.GETORDER,res.data.playlists)
                resolve();
            })
            .catch((error) => {
                console.log(error)
            })
        })
    },
    getVideoList:function({commit} , message) {
        return new Promise((resolve, reject) =>{
            ajax.get({
                url:'/mv/first?limit=10',
            }).then((res) => {
                commit(types.GETVIDEOLIST,res.data.data)
                resolve();
            })
            .catch((error) => {
                console.log(error)
            })
        })
    },
    playMv:function ({commit} , message) { 
        return new Promise((resolve, reject) => {
            ajax.get({
                url:'/mv?mvid='+message,
            }).then((res) =>{
                commit(types.PLAYMV,res.data)
                resolve();
            })
            
        })
     }
}
